Helpful Information
 
 
Category: Webmail
Webmail => Problems in connecting to mailbox

Hi all,

I am now doing a webmail system using PHP.

OS : redhat linux 8
Web Server : Apache
database : MySQL
Mail Server : POP3 and sendmail

I never use DNS and everything is running as localhost.

when I try to connect to my mailbox using webpage, the page show me error message that it cant open stream for this connection.

Below is my code :
$mbox = imap_open("{localhost:110/pop3}INBOX",test,testing,OP_HALFOPEN)
or die("can't connect: ".imap_last_error());

Error Message:
Warning: Couldn't open stream {localhost:110/pop3}INBOX in /var/www/html/conn.php on line 2
can't connect:

Can anyone let me know where my mistake lies ?
Thanks for help.


regards,
Lotus

Hi


Many times you will have trouble with imap, it really has to do with the type of imap (C Client) you are using, it's sort of a trail and error thing as each setup lets you do things differently. On RedHat I found that you have to also add the (type) command that (C Client) uses to your connection string...

Now like I said I do not know which version you are using but try this and tell me if it connects for you!





$mbox = imap_open("{localhost:110/pop3/notls}INBOX",user,pass,OP_HALFOPEN) or die("can't connect: ".imap_last_error());




F!

Thanks Fataqui. Really thanks a lot.

The programme works after I use the code u provided.

But may I know what is the reason we need to add in 1 more command "notls" in the code body ? When I refer to PHP help, I never even saw this command b4 .....


regards,
Lotus

Hi lotus


I will try to explain each connection....

The University of Washington, is sort of like the mayor of IMAP standards, they have designed a set of rules that all mail servers must maintain in order to be real IMAP4rev1 mail servers! Now IMAP and POP are very different, but they both share the same connection rules!

These rules have become a standard that more mail servers and MTA's will have to follow in order for them to handle connections from other mail servers or MTA's!

Some of the rules are to help mail transfer become more secure, as to stop network scanners from grabbing mailing that is not bound for them! It might shock you to know that 1 out of every 5 messages are high-jacked in transit!


This is why many use PGP to sign a message they send, this way you know it has not been altered during transit! PGP is very good security, but would not be needed when sending mail, if the sending mail server or MTA, and the receiving mail server or MTA, both used SSL tunneling! This is where the new connection standards come into play! They allow for secure connections if the server supports it, and if it does not, you know it because you can not connect to the server using a secure connection protocol!

This is why both IMAP and POP share these new connection rules! Also SMTP uses these rules but they are different for that protocol!


So let me explain them for you!

IMAP....

Standard Connection = /imap

Server states it has ssl support = /imap/notls

^ this depends on the (C Client) you are using (2001 -> X)and that you are using PHP 4.1.0 -> X!

server uses ssl and certificate is valid (not self signed) = /imap/ssl

server uses ssl and certificate is valid (self signed) = /imap/ssl/novalidate-cert


POP


Standard Connection = /pop3

Server states it has ssl support = /pop3/notls

^ this depends on the (C Client) you are using (2001 -> X)and that you are using PHP 4.1.0 -> X!

server uses ssl and certificate is valid (not self signed) = /pop3/ssl

server uses ssl and certificate is valid (self signed) = /pop3/ssl/novalidate-cert




F!










privacy (GDPR)